package xml
{
	import flash.filesystem.File;
	import flash.filesystem.FileMode;
	import flash.filesystem.FileStream;

	public class MyFile
	{
		public function MyFile()
		{
		}
		public function readFile(path:String):String{
			var text:String = "";
			var file:File = new File(path);
			var fileStream:FileStream = new FileStream();
			try{
				fileStream.open(file,FileMode.READ);
				text = fileStream.readMultiByte(fileStream.bytesAvailable,File.systemCharset);
			}catch(e:Error){
				trace("error:"+e);
			}finally{
				fileStream.close();
			}
			return text;
		}
		public function writeFile(path:String,text:String):void{
			var file:File = new File(path);
			var fileStream:FileStream = new FileStream();
			try{
				fileStream.open(file,FileMode.WRITE);
				fileStream.writeMultiByte(text,File.systemCharset);
			}catch(e:Error){
				trace("error:"+e);
			}finally{
				fileStream.close();
			}
		}	
	
	}
}